﻿/*
 * Popit.as
 * Created On: 1/7/2010 5:47 PM
 */
 package net.yogadigital.popit 
 {
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import net.yogadigital.popit.core.PopitWindow;
	
	public class PopitManager
	{
		private static var instance:PopitManager;
		private static var _popupObjectPool:Array;
		public static var _preloaderURL: String = "assets/Preloader.swf";
 
		/* Popit
		 * Use Popit.instance
		 * @param singleton DO NOT USE THIS - Use Popit.instance */
		public function PopitManager(p_key:SingletonBlocker):void 
		{
			 // this shouldn't be necessary unless they fake out the compiler:
			 if (p_key == null) {
					throw new Error("Error: Instantiation failed: Use Popit.getInstance() instead of new.");
				}
		 }
 
		/* instance
		 * Gets the Popit instance */
		public static function getInstance():PopitManager
		{
			 if (instance == null) 
			 {
					instance = new PopitManager(new SingletonBlocker());
				}
			 return instance;
		 }
		
		/**
		 * Retrieves a PopitWindow element with a given ID
		 * @param	id	The ID of the Window
		 * @return		The reference to the PopitWindow
		 */
		/*public function getElementByID(id:uint):PopitWindow
		{
			return new PopitWindow("Test", this, "");
		}*/
		
		/**
		 * Returns a PopitWindow element with a given name
		 * @param	name	The name of the Window
		 * @return			The reference to the PopitWindow
		 */
		/*public function getElementByName(name:String):PopitWindow
		{
			return new PopitWindow("Test", this, "");
		}*/
	}
}
internal class SingletonBlocker {}